AsParallel(TSource) Method (Partitioner(TSource))

Task Parallel System.Threading

Enables parallelization of a query, as sourced by a partitioner responsible for splitting the input sequence into partitions.

Namespace:  System.Linq
Assembly:  System.Threading (in System.Threading.dll)

Syntax

Visual Basic (Declaration)
Public Shared Function AsParallel(Of TSource) ( _
	source As Partitioner(Of TSource) _
) As ParallelQuery(Of TSource)
C#
public static ParallelQuery<TSource> AsParallel<TSource>(
	Partitioner<TSource> source
)

Parameters

source
Type: System.Collections.Concurrent..::.Partitioner<(Of <(TSource>)>)
A partitioner over the input sequence.

Type Parameters

TSource
The type of elements of source.

Return Value

The source as a ParallelQuery to bind to ParallelEnumerable extension methods.

Remarks

The source partitioner's GetOrderedPartitions method is used when ordering is enabled, whereas the partitioner's GetPartitions is used if ordering is not enabled (the default). The source partitioner's GetDynamicPartitions and GetDynamicOrderedPartitions are not used.

Exceptions

ExceptionCondition
System..::.ArgumentNullException source is a null reference (Nothing in Visual Basic).

See Also